
package com.springcloud.zuul.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.springcloud.zuul.common.annotation.Phone;
import com.springcloud.zuul.common.validator.group.AddGroup;
import com.springcloud.zuul.common.validator.group.UpdateGroup;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.validation.constraints.*;
import java.io.Serializable;
import java.util.List;

/**
 * 系统用户
 *
 */
@EqualsAndHashCode(callSuper = true)
@Data
@TableName("sys_user")
public class SysUserEntity extends CommonEntity implements Serializable{

	private static final long serialVersionUID = 1L;
	
	/**
	 * guid
	 */
	@TableId
	private String guId;

	/**
	 * 用户ID
	 */
	@NotBlank(message="用户ID不能为空！", groups = {AddGroup.class, UpdateGroup.class})
	private String userId;

	/**
	 * 用户类型    0.公司用户   1.个人用户
	 */
	@NotNull(message ="用户类型不能为空！",groups = {AddGroup.class, UpdateGroup.class})
	@Min(value = 0,message = "用户类型不合法！",groups = {AddGroup.class, UpdateGroup.class})
	@Max(value = 1,message = "用户类型不合法！",groups = {AddGroup.class, UpdateGroup.class})
	private int userType;

	/**
	 * 用户来源编码
	 */
	private String sourceId;

	/**
	 * 公司编码
	 */
	private String deptId;

	/**
	 * 公司编码
	 */
	@TableField(exist=false)
	private String deptName;

	/**
	 * 是否特殊登陆账号    0.否   1.是
	 * 手机注册或者邮箱注册,会分配默认的资料
	 */
	@NotNull(message ="特殊账号类型不能为空！",groups = {AddGroup.class, UpdateGroup.class})
	@Min(value = 0,message = "特殊账号类型不合法！",groups = {AddGroup.class, UpdateGroup.class})
	@Max(value = 1,message = "特殊账号类型不合法！",groups = {AddGroup.class, UpdateGroup.class})
	private int nonSpecial;

	/**
	 * 登录名
	 */
	@NotBlank(message="登录名不能为空！", groups = {AddGroup.class, UpdateGroup.class})
	private String loginName;

	/**
	 * 密码
	 */
	@NotBlank(message="密码不能为空！", groups = AddGroup.class)
	private String password;

	/**
	 * 盐
	 */
	@NotBlank(message="密码盐不能为空！", groups = {AddGroup.class, UpdateGroup.class})
	private String salt;

	/**
	 * 工号
	 */
	private String no;

	/**
	 * 姓名
	 */
	@NotBlank(message="姓名不能为空！", groups = {AddGroup.class, UpdateGroup.class})
	private String userName;

	/**
	 * 邮箱
	 */
	@NotBlank(message="邮箱不能为空！", groups = {AddGroup.class, UpdateGroup.class})
	@Email(message="邮箱格式不正确！", groups = {AddGroup.class, UpdateGroup.class})
	private String email;

	/**
	 * 手机号
	 */
	@NotBlank(message="手机号不能为空！", groups = {AddGroup.class, UpdateGroup.class})
	@Phone(message = "手机号不正确！",groups = {AddGroup.class, UpdateGroup.class})
	private String phone;

	/**
	 * 用户头像
	 */
	private String userImg;

	/**
	 * 注册Mac地址
	 */
	private String macAddress;

	/**
	 * 最后登录IP
	 */
	private String loginIp;

	/**
	 * 最后登录时间
	 */
	private String loginTime;

	/**
	 * 产品ID列表
	 */
	@TableField(exist=false)
	private List<String> productList;
	/**
	 * 角色ID列表
	 */
	@TableField(exist=false)
	private List<String> roleList;
	/**
	 * 权限功能ID列表
	 */
	@TableField(exist=false)
	private List<String> menuList;

}
